<%@page import="cn.sendto.service.ParkInfoService"%>
<%@page import="cn.sendto.model.ParkInfoModel"%>
<%@page import="java.util.HashMap"%>
<%@page import="java.util.ArrayList"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"  errorPage="../err.jsp"%>
    <jsp:include page="../lock.jsp"></jsp:include>
<%
	request.setCharacterEncoding("UTF-8");

	String Classid = request.getParameter("ClassId");
	String Classname = request.getParameter("ClassName");
	String Classstatus = request.getParameter("parktype");
	String Seatnumber = request.getParameter("Classstatus");
	String jssm = request.getParameter("Seatnumber");
	 //验证数据的有效性
   
     
    //存储数据
    ParkInfoModel pim = new ParkInfoModel();
    pim.setClassId(Integer.parseInt(Classid) );
    pim.setClassName(Classname);
    pim.setClassStatus(Classstatus);
    pim.setSeatNumber(Integer.parseInt(Seatnumber));
    pim.setJssm(jssm);
	
	ParkInfoService pis =new ParkInfoService();
    int rows = pis.add(pim);
    if(rows > 0){
    //返回注册页面
   	 request.setAttribute("addparkinfo", "添加成功，可以继续添加或者"+"<a href='parklist.jsp'>点击此处返回教室列表</a>");
   	 request.getRequestDispatcher("addpark.jsp").forward(request, response);
   	 return;
    }else if(rows == -1){
    	 request.setAttribute("addparkinfo", "添加失败,教室已存在");
       	 request.getRequestDispatcher("addpark.jsp").forward(request, response);
       	 return;
    }
    else{
   	 request.setAttribute("addparkinfo", "添加失败。");
   	 request.getRequestDispatcher("addpark.jsp").forward(request, response);
   	 return;
    }
%>